/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_mission")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvMission.findAll", query = "SELECT c FROM CvMission c"),
    @NamedQuery(name = "CvMission.findByIdmission", query = "SELECT c FROM CvMission c WHERE c.idmission = :idmission"),
    @NamedQuery(name = "CvMission.findByActive", query = "SELECT c FROM CvMission c WHERE c.active = :active")})
public class CvMission implements Serializable {
    @Column(name = "nom_mission")
    private String nomMission;
    @Column(name = "active")
    private boolean active;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idmission")
    private String idmission;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idmission", fetch = FetchType.EAGER)
    private List<CvListedepartement> cvListedepartementList;

    public CvMission() {
    }

    public CvMission(String idmission) {
        this.idmission = idmission;
    }

    public String getIdmission() {
        return idmission;
    }

    public void setIdmission(String idmission) {
        this.idmission = idmission;
    }
    
    @XmlTransient
    @JsonIgnore
    public List<CvListedepartement> getCvListedepartementList() {
        return cvListedepartementList;
    }

    public void setCvListedepartementList(List<CvListedepartement> cvListedepartementList) {
        this.cvListedepartementList = cvListedepartementList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idmission != null ? idmission.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvMission)) {
            return false;
        }
        CvMission other = (CvMission) object;
        if ((this.idmission == null && other.idmission != null) || (this.idmission != null && !this.idmission.equals(other.idmission))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvMission[ idmission=" + idmission + " ]";
    }

    
    public String getNomMission() {
        return nomMission;
    }

    public void setNomMission(String nomMission) {
        this.nomMission = nomMission;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }
    
}
